<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>3.v-if的真正使用场景</title>
    <!-- 引入Vue -->
    <script type="text/javascript" src="../../vue.js"></script>
  </head>
  <body>
    <!-- 准备好一个容器-->
    <div id="demo">
      <h2 v-if="person.hobby">最浪费钱的一个爱好：{{person.hobby.h3}}</h2>
    </div>

    <script type="text/javascript">
      let vm = new Vue({
        el:'#demo',
        data:{
          person:{}
        }
      })
      
      setTimeout(() => {
        vm.person = {
          name:'马志强',
            hobby:{
              h1:'抽烟',
              h2:'喝酒',
              h3:'烫头'
            }
        }
      }, 3000);
    </script>
  </body>
</html>